﻿<%--
  Created by IntelliJ IDEA.
  User: xiaoji
  Date: 2014/12/8
  Time: 13:33
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set value="${pageContext.request.contextPath}" var="path" scope="page"/>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<html>
<head>
    <title></title>
    <script type="text/javascript" src="${path}/style/acg/js/common.js"></script>
    <script>
        $(function(){
            //分类异步获取
            $.get("${path}/home/getProjectClasses.html",{},function(data){
                var secondLevel = data.secondLevel;
                var thirdLevel = data.thirdLevel;
                var htmlstr="";

                for(var i=0;i<secondLevel.length;i++){
                    var s = secondLevel[i];
                    var db = i%2==0?"":"db";
                    htmlstr += '<div class="item '+db+'">'+
                    '<h3><a href="${path}/taskList/taskList.html?firstClass='+ s.id +'">'+ s.name +'</a><s></s></h3>'+
                    '<div class="i-mc">'+
                    '      <div class="subitem">'+
                    '       <dl class="first">'+
                    '        <dt><a href="#"></a></dt>'+
                    '<dd>';
                    for(var j=0;j<thirdLevel.length;j++){
                        var t = thirdLevel[j];
                        if(s.id == t.parent){
                            htmlstr += '<em><a href="${path}/taskList/taskList.html?firstClass='+ s.id +'&secondClass='+ t.id+'">'+ t.name+'</a></em>';
                        }
                    }
                    htmlstr +='</dd>'+
                    '</dl>'+
                    '</div>'+
                    '<div class="clr"></div>'+
                    '</div>'+
                    '</div>';

                }
                htmlstr +='<div class="item db">'+
                        '<h3 class="item_more"><a href="${path}/taskList/taskList.html"><spring:message code="home.more"/></a><s></s></h3>'+
                        '<div class="clr"></div>'+
                        '</div>';
                $("#itemshow").html(htmlstr);

                $(".item-show >.item").hover(
                        function(){
                            $(this).addClass("selected");
                            $(this).find('.i-mc').show();
                        },
                        function(){
                            $(this).removeClass("selected");
                            $(this).find('.i-mc').hide();
                        }
                );
            },"json");
            //头部登录验证
            $.post("${path}/home/isAjaxLogin.html",{},function(data){
                if(data.status==0){
                    var htmlstr = "<a href='${path}/usercenter/index.html'><spring:message code='home.welcomeYou' arguments='"+data.userInfo.userName+"' argumentSeparator=','/></a>"+
                                  "<a href='javascript:void(0);' onclick='logout()'><spring:message code="home.exit"/></a>";
                    $("#loginresult").html(htmlstr);
                }else{
                    var htmlstr = '<a href="${path}/register/toRegister.html"><spring:message code="home.register"/></a>'+
                                    '<a href="${path}/login/index.html"><spring:message code="home.login"/></a>';
                    $("#loginresult").html(htmlstr);
                }
            },"json");
            $("#changeLang").click(function(){
                var lang = "zh_CN";
                if($(this).html()== "English")lang="en";
                window.location.href='${path}/acg/language.html?language='+lang+'&url='+document.location.href;
            });
        });

        function logout(){
            $.post("${path}/login/logout.html",{},function(data){
                if(data.success == 0){
                    var url= window.location.href;
                    if(url.indexOf('/usercenter')){
                        window.location.href='${path}/';
                    }else{
                        window.location.reload();
                    }

                }
            },"json");
        }

        //下载文件
        function f_download(url){
            url = encodeURIComponent(encodeURIComponent(url))
            window.location.href = "${path}/fileDownload/download_file.html?res_url="+url;

        }

        //综合搜索弹出层
        <%--function f_queryDiv(value){--%>

            <%--$("#queryDiv").show();--%>
            <%----%>
            <%--$.ajax({--%>
                <%--type: "POST",--%>
                <%--url: "${path}/taskList/associativeSearch.html",--%>
                <%--data: {name:value},--%>
                <%--dataType: "json",--%>
                <%--success: function (data) {--%>

                    <%--var html = "";--%>

                    <%--console.log(encodeURI(encodeURI(value)));--%>
                    <%--html += "            <ul>";--%>
                    <%--html += " <a href='${path}/artistList/artistList.html?keyword="+encodeURI(encodeURI(value))+"'><li><spring:message code="home.search_among_artists" />“"+value+"”</li></a>";--%>
                    <%--html += " <a href='${path}/productionList/productionList.html?keyword="+value+"'><li><spring:message code="home.search_in_the_works"/>“"+value+"”</li></a>";--%>

                    <%--for(var i in data){--%>

                        <%--var bean = data[i];--%>

                        <%--html += " <a href='${path}/taskdetail/index.html?taskId="+bean.item_id+"'><li>"+bean.title+"</li></a>";--%>

                    <%--}--%>

                    <%--html += " </ul>";--%>

                    <%--$("#queryDiv").html(html);--%>
                <%--}--%>
            <%--});--%>



        <%--}--%>
    </script>
</head>
<body>
<input type="hidden" id="path" value="${path}">
<div class="header">
    <div class="shortCut">
        <div class="headbox clearfix">
            <%--<div class="applink"><a href="javascript:void(0);" class="app"><spring:message code="home.phone_clint"/></a></div>--%>
            <div class="loginBar">
                <span id="loginresult">

                </span>
                <a target="_blank" id="wantquestion_qq" href="http://wpa.qq.com/msgrd?v=3&uin=2217239218&site=qq&menu=yes"><spring:message code="home.contact"/></a>
                <c:if test="${sessionScope.curUser.userName != null}">
                    <a href="${path}/usercenter/index.html" style=""><spring:message code="home.usercenter"/></a>
                </c:if>
                <a href="${path}/new/index.html" id="changeLang2"><spring:message code="home.news"/></a>
                <a href="javascript:void(0);" id="changeLang"><spring:message code="home.language"/></a>
            </div>
        </div>
    </div>
    <div class="headbox clearfix">
        <div class="logo"><a href="${path}/"></a></div>
        <div class="searchheader clearfix">
            <div class="i-search ld">
                <ul id="shelper" class="hide">


                    <li class="close" onclick="$o.hideTip()"><spring:message code="home.close"/></li>
                </ul>
            <div class="form">
                <input class="sea_input" accesskey="s" onkeydown="javascript:if(event.keyCode==13) search('key');" style="color: rgb(51, 51, 51);" id="sea_key" type="text" autocomplete="off" name="key" value="<spring:message code="home.search"/>" onFocus="if(this.value=='<spring:message code="home.search"/>'){this.value='';}"  onblur="if(this.value==''){this.value='<spring:message code="home.search"/>';}" />
                <input  id="FullSearch" type="button" onclick="if('<spring:message code="home.search"/>' == $('#sea_key').val()){$('#sea_key').val('')}window.location.href='${path}/taskList/taskList.html?keyword=' + encodeURI(encodeURI($('#sea_key').val()))" value="<spring:message code="home.search.button"/>" class="sea_btn" >
            </div>
        </div>
        </div>
        <div class="fbxm">
            <a href="${path}/publishTask/publishTaskIndex.html"><spring:message code="home.release.project"/></a>
        </div>
        <div class="clr"></div>
    </div>
</div>

<div class="navbox">
<div class="wrapper">
<ul class="navlist">
<li class="dh_cursor">
<div class="dhmenu">
<c:if test="${param.usercenter == true}">
    <h1 class="dhmenu_tit" style="background:url('')" >个人中心</h1>
    <div class="showmenu" >
    <div class="item-show" >
</c:if>
<c:if test="${param.usercenter != true}">
        <h1 class="dhmenu_tit"  <c:if test="${param.home!='home'}">id="show_menu"</c:if>><spring:message code="home.project.class"/></h1>
        <div class="showmenu" <c:if test="${param.home=='home'}">id="shown"</c:if>>
        <div class="item-show" id="itemshow">
</c:if>



</div>
</div>
</div>
</li>
<li><a id="index" href="${path}/" class="dh_pack"><spring:message code="home.index"/></a></li>
<%--<li><a id="index2" href="Official.html" class="dh_pack"><spring:message code="home.official_outsourcing"/></a></li>--%>
<li><a id="taskList" href="${path}/taskList/taskList.html" class="dh_pack"><spring:message code="home.out_project"/></a></li>
<li><a id="artist" href="${path}/artist/index.html" class="dh_pack"><spring:message code="home.artist"/></a></li>
<li><a id="race" href="${path}/race/index.html" class="dh_pack"><spring:message code="home.competition_activities"/></a></li>
<li><a id="productionList" href="${path}/productionList/productionList.html" class="dh_pack"><spring:message code="home.works"/></a></li>
</ul>
</div>
</div>
<script>
    $(function(){
        var url = window.location+"";

        var indexVal = url.substring(url.lastIndexOf("/")+1);
        if(url.indexOf("taskList/taskList.html") != -1){
            $("#taskList").addClass("on");
        }else if(url.indexOf("artist/index.html")  != -1
                || url.indexOf("artistPersonalHome/artistPersonalHome.html")  != -1){
            $("#artist").addClass("on");
        }else if(url.indexOf("/race")  != -1){
            $("#race").addClass("on");
        }else if(url.indexOf("productionList/productionList.html")  != -1 || url.indexOf("/artistPersonalHome/browseProduction.html")  != -1){
            $("#productionList").addClass("on");
        }else if(url.indexOf("index2/index2.html")  != -1){//官方外包
            $("#index2").addClass("on");
        }else if(indexVal == ""){
            $("#index").addClass("on");
        }

    });
</script>


</body>
</html>
